package book;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 三石
 * Date: 2022-05-21
 * Time: 17:52
 */
public class BookList {

    //用来存放书（10本）的数组
    private Book[] books=new Book[10];

    //用来实时记录Book[]数组有多少本书
    private int usedSize;

    public BookList(){
        books[0]=new Book("三国演义","罗贯中",19.00,"小说");
        books[1]=new Book("红楼梦","曹雪芹",29.00,"小说");
        books[2]=new Book("水浒传","施耐庵",23.00,"小说");
        usedSize=3;

    }

    /**
     * 获取书的内容
     * @param pos此时是合法的
     * @return
     */
    public Book getBook(int pos) {
        return books[pos];
    }

    /**
     * 放书进特定的位置
     * @param book是你要放的书
     * @param pos是书要放的位置，必须是合理的
     */
    public void setBooks(int pos,Book book) {
        books[pos] = book;
    }

    /**
     * 实时获取当前书的个数
     * @return
     */
    public int getUsedSize(){
        return usedSize;
    }

    /**
     * 实时修改书架上书的个数
     */
    public void setUsedSize(int size){
        usedSize=size;
    }
}
